Skip to content

feat: TIP-1035#3828

Open
klkvr wants to merge 3 commits intomainfrom
klkvr/tip-1035
Open

feat: TIP-1035#3828
klkvr wants to merge 3 commits intomainfrom
klkvr/tip-1035

Conversation

@klkvr
Copy link
Copy Markdown
Member

@klkvr klkvr commented May 5, 2026

Closes CHAIN-1144

Adds isImplicitlyApproved method to AddressRegistry and changes stablecoind DEX to use system_transfer_from post-T5.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
tempo-contracts: minor
tempo-precompiles: minor
---

Added TIP-1035 Implicit Approval List with `isImplicitlyApproved` view on the AddressRegistry precompile (gated on T5), and updated `TIP20Token::system_transfer_from` to require the caller be on the list at T5+. Wired `StablecoinDEX` and `TipFeeManager` to use the new system-transfer signature.

Add changelog to commit this to your branch.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

📊 Tempo Precompiles Coverage

precompiles

Coverage: 5634/7729 lines (72.89%)

File details
File Lines Coverage
src/account_keychain/dispatch.rs 30/68 44.12%
src/account_keychain/mod.rs 274/736 37.23%
src/address_registry/dispatch.rs 31/36 86.11%
src/address_registry/mod.rs 55/65 84.62%
src/error.rs 39/114 34.21%
src/ip_validation.rs 10/10 100.00%
src/lib.rs 181/216 83.80%
src/nonce/dispatch.rs 9/10 90.00%
src/nonce/mod.rs 46/61 75.41%
src/signature_verifier/dispatch.rs 19/20 95.00%
src/signature_verifier/mod.rs 13/17 76.47%
src/stablecoin_dex/dispatch.rs 92/93 98.92%
src/stablecoin_dex/mod.rs 869/924 94.05%
src/stablecoin_dex/order.rs 110/161 68.32%
src/stablecoin_dex/orderbook.rs 157/216 72.69%
src/storage/evm.rs 192/221 86.88%
src/storage/hashmap.rs 0/158 0.00%
src/storage/mod.rs 27/27 100.00%
src/storage/packing.rs 68/93 73.12%
src/storage/thread_local.rs 165/227 72.69%
src/storage/types/array.rs 0/72 0.00%
src/storage/types/bytes_like.rs 79/162 48.77%
src/storage/types/mapping.rs 27/48 56.25%
src/storage/types/mod.rs 67/91 73.63%
src/storage/types/primitives.rs 21/24 87.50%
src/storage/types/set.rs 28/192 14.58%
src/storage/types/slot.rs 55/81 67.90%
src/storage/types/vec.rs 101/246 41.06%
src/tip20/dispatch.rs 149/165 90.30%
src/tip20/mod.rs 593/697 85.08%
src/tip20/rewards.rs 238/252 94.44%
src/tip20/roles.rs 107/110 97.27%
src/tip20_factory/dispatch.rs 17/18 94.44%
src/tip20_factory/mod.rs 105/125 84.00%
src/tip403_registry/dispatch.rs 55/56 98.21%
src/tip403_registry/mod.rs 334/371 90.03%
src/tip_fee_manager/amm.rs 287/364 78.85%
src/tip_fee_manager/dispatch.rs 81/83 97.59%
src/tip_fee_manager/mod.rs 71/136 52.21%
src/validator_config/dispatch.rs 38/52 73.08%
src/validator_config/mod.rs 171/227 75.33%
src/validator_config_v2/dispatch.rs 71/73 97.26%
src/validator_config_v2/mod.rs 552/611 90.34%

contracts

Coverage: 1/226 lines (0.44%)

File details
File Lines Coverage
src/lib.rs 1/1 100.00%
src/precompiles/account_keychain.rs 0/37 0.00%
src/precompiles/address_registry.rs 0/9 0.00%
src/precompiles/nonce.rs 0/18 0.00%
src/precompiles/signature_verifier.rs 0/3 0.00%
src/precompiles/stablecoin_dex.rs 0/21 0.00%
src/precompiles/tip20.rs 0/49 0.00%
src/precompiles/tip20_factory.rs 0/9 0.00%
src/precompiles/tip403_registry.rs 0/15 0.00%
src/precompiles/tip_fee_manager.rs 0/15 0.00%
src/precompiles/validator_config.rs 0/13 0.00%
src/precompiles/validator_config_v2.rs 0/36 0.00%

Total: 5635/7955 lines (70.84%)

📦 Download full HTML report

amount: U256::from(amount),
},
)?;
fn transfer_from(&mut self, token: Address, sender: Address, amount: u128) -> Result<()> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create this fn as a new TIP20 helper (i.e transfer_from_internal(&mut self, caller: Address, from: Address, amount: U256) which routes based on AddressRegistry::is_implicitly_approved()?

it would ensure that impl and registry are always aligned + that to is always the caller precompile

Copy link
Copy Markdown
Member Author

@klkvr klkvr May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added here be93800

/// Precompiles on this list are authorized to call
/// [`crate::tip20::TIP20Token::system_transfer_from`], pulling TIP-20 tokens from a user without a
/// prior `approve()`. The list is gated on `TempoHardfork::T5`; before activation it is empty.
pub const IMPLICIT_APPROVAL_LIST: &[Address] = &[TIP_FEE_MANAGER_ADDRESS, STABLECOIN_DEX_ADDRESS];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add TIP_20_ESCROW_PRECOMPILE to this, ig it also needs to be updated in the TIP itself.
CC: @danrobinson

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't yet have this const defined so i'd suggest we do it in scope of TIP-1034

@klkvr klkvr force-pushed the klkvr/tip-1035 branch from 4daaf17 to be93800 Compare May 6, 2026 12:06
@decofe decofe added the T5 label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants